// API 地址配置
const api = {

    updateServerAddressBook: '/server-address-book/updateServerAddressBook',
    selectServerAddressBookById: '/server-address-book/selectServerAddressBookById',
    addServerAddressBook: '/server-address-book/addServerAddressBook',
    selectServerAddressBook: '/server-address-book/selectServerAddressBook',
    deleteServerAddressBook: '/server-address-book/deleteServerAddressBook/{id}',
	
	//上传或者修改用户默认地址
	updateDefaultAddress:'/server-user/updateServerUserAddress'
}

// 修改服务商地址簿
export const updateServerAddressBook = (serverUpdateAddAddressBookDto) => {
    return uni.$http.post(api.updateServerAddressBook, serverUpdateAddAddressBookDto);
}

// 根据地址 ID 查询服务商地址簿
export const selectServerAddressBookById = (id) => {
   return uni.$http.get(`${api.selectServerAddressBookById}/${id}`);  
}

// 新增服务商地址簿
export const addServerAddressBook = (serverAddAddressBookDto) => {
	console.log("接口函数这边的数据")
	console.log(serverAddAddressBookDto)
    return uni.$http.post(api.addServerAddressBook, serverAddAddressBookDto);
}

// 查询服务商地址簿
export const selectServerAddressBook = () => {
    return uni.$http.get(api.selectServerAddressBook);
}

// 删除服务商地址簿
export const deleteServerAddressBook = (id) => {
    return uni.$http.get(api.deleteServerAddressBook.replace('{id}', id));
}


//更新或者上传默认地址
export const updateDefaultAddress=(data)=>{
	 console.log("api这边接收的数据")
	 console.log(data);
	 return uni.$http.post(api.updateDefaultAddress, data);
}